
//
// 130311 - Created.
//

package org.japril.servlet.httpannotations;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * <p>
 *   Method annotation to tell method maps to a request.
 * </p>
 * @author Arne Halvorsen (AH)
 */
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
public @interface HttpRequest 
{
  /**
   * <p>
   *   Gets action of request.
   * </p>
   * @return Name or default value "[from-method-name]" which dictates request
   *         name is to be derived from method name.
   */
  String action() default "[from-method-name]";
  
  /**
   * <p>
   *   Description.
   * </p>
   * @return Description or empty string if not given.
   */
  String desc() default "";
  
  /**
   * <p>
   *   Tells if post or get (default) method should be used for request.
   * </p>
   * @return {@code true} if <i>post</i> request, {@code false} (default)
   *         if <i>get</i> request.
   */
  boolean post() default false;
  
  /**
   * <p>
   *   Name on a form giving input to request.
   * </p>
   * @return Name, default is "input"
   */
  String name() default "input";
  
  /**
   * <p>
   *   Tells if request requires authentication. 
   * </p>
   * @return {@code true} if does, {@code false} (default) if does not.
   */
  boolean authentication() default false;
  
  /**
   /**
   * <p>
   *   Gets the encoding type of request's reply.
   * </p>
   * @return Type or the empty string if not specified.
   */
  String enctype() default "";
  
}
